﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>分佣已结算(可提)日志表</title>
    <link href="/style/rightdirectory.css" rel="stylesheet" />
    <script src="/script/config.js"></script>
</head>
<style>
    th {
        text-align: center;
    }
    td {
        text-align: center;
    }
    .detail {
        color: darkcyan;
    }
</style>
<body>
    <div class="view-page">
        <!--搜索区域-->
        <div class="view-search inline">
            <div class="form-inline">
                <div class="form-group col-sm-2">
                    <div class="input-group">
                        <span class="input-group-addon">受益人</span>
                        <input id="query" type="text" class="form-control" data-form="IncomName" placeholder="受益人">
                    </div>
                </div>

                <div class="form-group col-sm-2">
                    <div class="input-group">
                        <span class="input-group-addon">购买人</span>
                        <input id="query3" type="text" class="form-control" data-form="buyName" placeholder="购买人">
                    </div>
                </div>

                <div class="form-group col-sm-2">
                    <div class="input-group">
                        <span class="input-group-addon">任务天数</span>
                        <input id="query2" type="text" class="form-control" data-form="TaskDay" placeholder="任务天数">
                    </div>
                </div>
                <div class="form-group col-sm-1">
                    <button type="button" id="btn-search" class="btn btn-primary">
                        <i class="fa fa-search"></i> 搜索
                    </button>
                </div>
            </div>
        </div>

        <div class="view-data">
            <table id="table" class="table table-bordered table-hover" data-post="">
                <thead>
                    <tr>
                        <th>
                            查看详情
                        </th>
                        <th>受益人</th>
                        <th>购买人</th>
                        <th>收益订单号</th>
                        <th>日志类型</th>
                        <th>变更余额</th>
                        <th>变更时间</th>
                        <th>备注说明</th>
                        <th>变更类型</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <!--分页条 默认选择id=list-page元素-->
            <div id="list-page" class="view-pagination-page"></div>
        </div>
    </div>
</body>

</html>
<script type="text/html" id="tp-table">
    {{each list d}}
    <tr data-eidt="{{d.Id}}">
        <td class="checkboxs">
            <label class="checkbox-reset">
                <input type="checkbox" value="{{d.Id}}" onclick="openDetail({{d.Id}})" />
            </label>
        </td>
        <td>{{d.IncomName}}</td>
        <td>{{d.buyName}}</td>
        <td>{{d.OrderNo}}</td>
        {{if d.Type==1}}
        <td>直推会员</td>
        {{else if d.Type==2}}
        <td>间推会员 </td>
        {{else if d.Type==3}}
        <td>购买产品收入 </td>
        {{else if d.Type==4}}
        <td>提现</td>
        {{/if}}
        <td>{{d.ChangeBalance}}</td>
        <td>{{d.CreateDate|to_date}}</td>
        <td>{{d.Descr}}</td>
        {{if d.ChangeType==2}}
        <td>减</td>
        {{else if d.ChangeType==1}}
        <td>加</td>
        {{/if}}
    </tr>
    {{/each}}
</script>

<script type="text/html" id="tp-order-detail">
    <div id="layre-order-detail" style="padding:10px">
        <div class="panel" id="tem">
            <div class="panel-heading">分佣已结算日志表</div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>受益人</th>
                            <th>购买人</th>
                            <th>收益订单号</th>
                            <th>日志类型  </th>
                            <th>变更前余额</th>
                            <th>变更余额</th>
                            <th>变更后余额</th>
                            <th>变更时间 </th>
                            <th>备注说明</th>
                            <th>变更类型</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
        </div>
    </div>
</script>


<script type="text/html" id="com-temp">
    {{set t=list}}
    <tr>
        <td>{{t.Id}}</td>
        <td>{{t.IncomName}}</td>
        <td>{{t.buyName}}</td>
        <td>{{t.OrderNo}}</td>
        {{if t.Type==1}}
        <td>直推会员 </td>
        {{else if t.Type==2}}
        <td>间推会员 </td>
        {{else if t.Type==3}}
        <td>购买产品收入 </td>
        {{else if d.Type==4}}
        <td>提现</td>
        {{/if}}
        <td>{{t.ChangeBeforeBalance}}</td>
        <td>{{t.ChangeBalance}}</td>
        <td>{{t.ChangeAfterBalance}}</td>
        <td>{{t.CreateDate|to_date}}</td>
        <td>{{t.Descr}}</td>
        {{if t.ChangeType==2}}
        <td>减</td>
        {{else if t.ChangeType==1}}
        <td>加 </td>
        {{/if}}
    </tr>

</script>

<script type="text/javascript">
    $(function () {
        function _LoadData() {  
            var parm = $(".view-search").getFormData();
            $("#table").ajaxPageTable("commissionclosinglog/list", parm, function (d) {
                console.log(d)
                $("#table>tbody").append(template("tp-table", {
                    list: d
                }));
            })
        }
        _LoadData();//初启化
        $(".form-control").focus(function () { //搜索按钮
            $(".form-control").keydown(function (e) {
                if (e.keyCode == 13) {
                    _LoadData();
                }
            })
        })
        $("#btn-search").click(function () { //搜索按钮
            _LoadData();
        })
    })

    function openDetail(o) {  //弹出订单详情
        $.layrePage({  //弹出
            area: ["90%", "800px"],
            title: "-",
            offset: "6px",
            content: template("tp-order-detail", {})
        });

        $.http.json("commissionclosinglog/find", { Id: o }, { //发出请求
            pass: function (d) {
               
                $("#layre-order-detail #tem table>tbody").append(template("com-temp", {//订单产品
                    list: d
                }));
            },
            error: function (d) {
                console.log(d)
            }
        })

    }
</script>